//
//  Image.swift
//  StandardKit
//
//  Created by 李加建 on 2021/10/13.
//

import StandardKit
import UIKit

public extension UIImage {
    convenience init?(named: String?, podName: String?) {
        guard let named = named else { return nil }
        if let podName = podName {
            self.init(named: named, in: Bundle.bundle(podName: podName), compatibleWith: nil)
        } else {
            self.init(named: named, in: nil, compatibleWith: nil)
        }
    }
}

public extension UIImageView {
    func setImgurl(_ urlString: String?, placeholder: UIImage? = nil) {
        if let urlString = urlString {
            kf.setImage(with: URL(string: urlString), placeholder: placeholder, options: nil, completionHandler: nil)
        }
    }
}
